package com.cqcj.wms.query;

import lombok.Data;

/**
 * @Author：weiwei
 * @name：UpdateResult  添加、修改、删除结果集封装
 * @Date：2024/9/28 16:06
 */
@Data
public class UpdateResult {
    private int code;//编码 200/400
    private String msg;//成功/失败 message
    private Object data;//数据


    public static UpdateResult fail(){
        return result(400,"失败",null);
    }

    /**
     * 接收失败消息
     * @param msg
     * @return
     */
    public static UpdateResult fail(String msg){
        return result(400,msg,null);
    }

    public static UpdateResult suc(){
        return result(200,"成功",null);
    }

    public static UpdateResult suc(Object data){
        return result(200,"成功",data);
    }
    private static UpdateResult result(int code, String msg, Object data){
        UpdateResult res = new UpdateResult();
        res.setMsg(msg);
        res.setCode(code);
        res.setData(data);
        return res;
    }
}
